
function refreshGold(data)
{
  var gold = data.gold;
  $('#gold_label').text = gold;
 // $.Msg(gold);
}
function UpdateGold()
{
  var queryUnit = Players.GetLocalPlayerPortraitUnit();
  var id = Entities.GetPlayerOwnerID( queryUnit );
  if(id>=0&&id<=3){
    var gold = CustomNetTables.GetTableValue( "gold", id ).val;
    $('#gold_label').text=gold;
    var food = CustomNetTables.GetTableValue( "food", id ).val;
    $('#food_label').text=food;
    var wood = CustomNetTables.GetTableValue( "wood", id ).val;
    $('#wood_label').text=wood;
  }
  

  $.Schedule(0.3,UpdateGold);
}

(function () {
  UpdateGold();
  //GameEvents.Subscribe( "__refresh__gold", refreshGold );
  GameUI.SetDefaultUIEnabled( DotaDefaultUIElement_t.DOTA_DEFAULT_UI_INVENTORY_GOLD, false ); 
  GameEvents.Subscribe( "dota_player_update_selected_unit", UpdateGold );
  GameEvents.Subscribe( "dota_player_update_query_unit", UpdateGold );
/*  GameEvents.Subscribe( "top_notification", TopNotification );
  GameEvents.Subscribe( "bottom_notification", BottomNotification );
  GameEvents.Subscribe( "top_remove_notification", TopRemoveNotification );
  GameEvents.Subscribe( "bottom_remove_notification", BottomRemoveNotification );
  GameEvents.Subscribe( "midleft_notification", MidLeftNotification );
  GameEvents.Subscribe( "midleft_remove_notification", MidLeftRemoveNotification );
  GameUI.CustomUIConfig().errorMessage = BottomNotification;*/
})();


